<!DOCTYPE html>
<html>
#{include file="header.html"}#
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
  <div class="row">
    <div class="col-sm-12">
      <div class="ibox float-e-margins">
        <div class="ibox-title">
          <h5><i class="fa fa-home"></i>会员管理</h5>
          <div class="ibox-tools"> <a href="#{$smarty.const.ACT}#/admin/Member/member_add/" class="btn btn-xs btn-primary"><i class="fa fa-plus"></i> 添加</a> <a href="?" class="btn btn-xs btn-danger"><i class="fa fa-refresh"></i>刷新</a> </div>
        </div>
		   	<div class="ibox-content">
            <form id="pagerForm" method="post"  class="form-inline">
              <div class="col-sm-3 m-b-xs">
                <a class="btn btn-info" href="#">导出数据</a>
						<div class="btn-group">
							<button data-toggle="dropdown" class="btn btn-danger dropdown-toggle">批量操作 <span class="caret"></span></button>
							<ul class="dropdown-menu">
								<li><a href="javascript:void(0)" class="batch_operation" data-act="del">批量删除</a></li>
							</ul>
						</div>
              </div>
              <div class="col-sm-9 m-b-xs text-right searchDateRange"> 注册时间：
                <div class="input-daterange input-group" id="datepicker1">
                  <input type="text" class="input-sm form-control" name="sdt1" placeholder="选择开始时间"/>
                  <span class="input-group-addon">到</span>
                  <input type="text" class="input-sm form-control" name="edt1" placeholder="选择结束时间" />
                </div>
					  <div class="form-group">
						<input type="text" name="name" placeholder="输入搜索帐号/手机/姓名" class="form-control">
					  </div>
                <div class="btn-group">
                  <button data-toggle="dropdown" class="btn  dropdown-toggle"><span class="caret"></span></button>
                  <div class="dropdown-menu">
                    <div class="ibox-content">
                      <div class="form-group">
                        <label>手机号</label>
                        <input type="text" name="mobile" placeholder="手机号" class="form-control">
                      </div>
                      <div class="form-group">
                        <label>内容</label>
                        <input type="text" name="content" placeholder="发送内容" class="form-control">
                      </div>
                      <div class="form-group">
                        <button type="button" class="btn btn-primary btn-xs btn-block ajaxSearchForm"><i class="fa fa-search"></i> 搜索</button>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="input-group"> 
							<span class="">
                  <button type="button" class="btn btn-primary ajaxSearchForm"><i class="fa fa-search"></i> 搜索</button>
                  </span> </div>
              </div>
            </form>
          	</div>
        <div class="ibox-content">
          <table class="table table-hover sorttable 07fly-table">
            <thead>
              <tr>
                <th width="22"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
                <th width="50">编号</th>
                <th width="120">会员帐号</th>
                <th width="120">分类</th>
                <th width="120">真实名称</th>
                <th width="120">手机</th>
                <th width="120">余额</th>
                <th width="120">积分</th>
                <th width="120">推荐人</th>
                <th width="150" orderField="by_adt" class="sort-filed"><span>注册时间</span></th>
                <th width="80">操作</th>
              </tr>
            </thead>
            <tbody></tbody>
					<tfoot class="ibox-content">
					  <tr>
						<td colspan="11" align="center"></td>
					  </tr>
					</tfoot>            
          </table>
        </div>
      </div>
    </div>
  </div>
</div>
<script id="tableListTpl" type="text/html">
<% for(var i=0;i<list.length;i++) { %>
	<tr>
		<td><input name="member_id" class="checkboxCtrlId" value="<%=list[i]['member_id']%>" type="checkbox"></td>
		<td><%=list[i]['member_id']%></td>
		<td><%=list[i]['account']%></td>
		<td><%=list[i]['type_name']%></td>
		<td><%=list[i]['name']%></td>
		<td><%=list[i]['mobile']%></td>
		<td><%=list[i]['balance']%></td>
		<td><%=list[i]['integral']%></td>
		<td><%=list[i]['parent_name']%></td>
		<td><%=list[i]['adt']%></td>
		<td width='10'>
			<div class="btn-group">
				<button data-toggle="dropdown" class="btn btn-info dropdown-toggle">操作 <span class="caret"></span></button>
				<ul class="dropdown-menu">
					<li><a href="#{$smarty.const.ACT}#/admin/Member/member_modify/member_id/<%=list[i]['member_id']%>/">修改</a></li>
					<li><a href="javascript:void(0)" class="single_operation" data-id="<%=list[i]['member_id']%>" data-act="del">删除</a></li>
				</ul>
			</div>
		</td>
	</tr>
<% } %>
</script>
<!-- 自定义js --> 
<script src="#{$smarty.const.APP}#/View/template/js/content.js?v=1.0.0"></script> 
<script>
var ajaxUrl='#{$smarty.const.ACT}#/admin/Member/member_json/';
$(document).ready(function () {
	turnPage(1);//页面加载时初始化分页

		$("body").on("click", ".batch_operation", function() {
		batch_act =$(this).attr("data-act")
		var chk_value =[]; 
    	$("tbody input[class='checkboxCtrlId']:checked").each(function(){ 
        chk_value.push($(this).val()); 
		}); 
		member_id_txt=chk_value.join(",");
		if(batch_act=="del"){
			act_url="#{$smarty.const.ACT}#/admin/Member/member_del/";
		}
    //alert(chk_value.length==0 ?'你还没有选择任何内容！':chk_value); 
		$.ajax({
			type: "POST",
			url: act_url,
			data:{"member_id":member_id_txt},
			dataType:"json",
			success: function(data){
				if(data.rtnstatus=='success'){
					layer.msg('操作成功', {icon: 1});
					turnPage(1);
				}
			},
			complete: function () {//完成响应
			}
		});
	});
	
	$("body").on("click", ".single_operation", function() {
		member_id =$(this).attr("data-id");
		single_act =$(this).attr("data-act")
		if(single_act=="del"){
			act_url="#{$smarty.const.ACT}#/admin/Member/member_del/";
		}
		$.ajax({
			type: "POST",
			url: act_url,
			data:{"member_id":member_id},
			dataType:"json",
			success: function(data){
				if(data.rtnstatus=='success'){
					layer.msg('操作成功', {icon: 1}); 
					turnPage(1);
				}
			}
		});
	});

});
</script>
</body>
</html>
